Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ukol 3 - Jan Suchánek #34

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open

Ukol 3 - Jan Suchánek #34

wants to merge 7 commits into from

Conversation

JanSuchanek
Copy link

Add simple insert address form for user

@JanSuchanek
Copy link
Author

JanSuchanek commented Oct 23, 2016

Vkládací formulář chci upravit ještě jako editační a připravit výpis více adres, tak aby se dali případně mazat.

"form" => $form->createView(),
];
}
// 2) handle the submit (will only happen on POST)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bacha tady, změnil jsi indent na mezery

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oj ok, díky

* @param Request $request
* @return RedirectResponse|array
*/
public function editAction(Request $request)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tady spíš logická - vlastně pokaždé přidáváš novou adresu. editAction tedy není zrovna vypovídající název

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Jasné, já sem ze začátku válčil jak to pojmenovat, máš pravdu.

private $id;

/**
* @ORM\Column(type="string", length=255, unique=false, name="firstName")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tady jdeš proti zbytku projektu, sloupec v db se bude jmenovat firstName, přestože jinde by to bylo first_name. Platí i pro ostatní sloupce

* @ORM\Column(type="string", length=255, unique=false, name="surName")
* @Assert\NotBlank()
*/
private $surName;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

když už tak lastName. Surname je jedno slovo

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok špatné názvosloví, díky.

@@ -23,6 +23,12 @@ class User implements UserInterface
*/
private $id;

/**
* @var Address
* @ORM\ManyToOne(targetEntity="Address")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tohle je bohužel špatně, ve formuláři přidáváš pokaždé novou adresu, tady připojuješ víc uživatelů k jedné adrese (což ani nedává smysl) správně by tato vazba měla být jako OneToMany

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok

public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add("firstName", EmailType::class, [
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rozházená indentace proti zbytku kódu

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ach jo, přitom jsem používal PHPStorm. Zkusím se polepšit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants